package com.ssmtest.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.ssmtest.pojo.Student;
import com.ssmtest.service.StudentService;

//@Controller
@RestController
@RequestMapping("stu/")
public class StudentController {
	@Autowired
	private StudentService studentService;
	@ResponseBody
	@RequestMapping("getBySId")
	public Student getBySId(@RequestParam("id") Integer id){
		
		return studentService.getById(id);
	}
	
//	@ResponseBody
	@RequestMapping("getAllStu")
	public List<Student> getAllStu(){
		return studentService.getAllStu();
	}
	@RequestMapping("saveStu")
	public Student saveStu(@RequestBody Student student){
		System.out.println(student);
		return student;
	}
}
